// pages/collect/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs: [
      { id: 0, value: "商品收藏", isActive: true },
      { id: 1, value: "品牌收藏", isActive: false },
      { id: 2, value: "店铺收藏", isActive: false },
      { id: 2, value: "浏览足迹", isActive: false }
    ],
    collect:[]
  },

  //title点击切换
  itemTap(e) {
    // console.log(e);
    const index = e.detail.index;
    let tabs = JSON.parse(JSON.stringify(this.data.tabs))
    tabs.forEach((item, i) => i === index ? item.isActive = true : item.isActive = false)
    this.setData({
      tabs
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    const collect = wx.getStorageSync("collect");
    this.setData({
      collect
    })
  },

})